using System.Data;
using System.Data.SqlClient;
using VanTaiProperty;
namespace VanTaiData
{
    public class clsTMVehicleInfo_In_OutController
    {
        private clsConnect cls = new clsConnect();

        #region[Get-Data]
        public DataTable BindGirdTMVehicleInfo_In_Out()
        {
            return cls.BindGridData("sp_TMVehicleInfo_In_Out");
        }
        public DataTable BindGirdTMVehicleInfo_In_Out_Detail_Edit(int id)
        {
            return cls.LayDuLieuParameter("sp_TMVehicleInfo_In_Out_Detail_Edit", "@RowID", id);
        }
        #endregion

        #region[Insert-Update-Delete]
        public bool InsertTMVehicleInfo_In_Out(clsTMVehicleInfo_In_OutProperty data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@CustomerNo", data.CustomerNo);
            cls.AddParameter("@CarNo", data.CarNo);
            cls.AddParameter("@Driver", data.Driver);
            cls.AddParameter("@Container", data.Container);
            cls.AddParameter("@DocumentDate", data.DocumentDate);
            cls.AddParameter("@DateIn", data.DateIn);
            cls.AddParameter("@Description", data.Description);
            cls.AddParameter("@Status", data.Status);
            cls.AddParameter("@UserID", data.UserID);
            cls.ExecuteNonQuery("sp_TMVehicleInfo_In_Out_Insert");
            return true;
        }
        public bool UpdateTMVehicleInfo_In_Out(clsTMVehicleInfo_In_OutProperty data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@RowID", data.RowID);
            cls.AddParameter("@CustomerNo", data.CustomerNo);
            cls.AddParameter("@CarNo", data.CarNo);
            cls.AddParameter("@Driver", data.Driver);
            cls.AddParameter("@Container", data.Container);
            cls.AddParameter("@DocumentDate", data.DocumentDate);
            cls.AddParameter("@Description", data.Description);
            cls.AddParameter("@UserID", data.UserID);
            cls.ExecuteNonQuery("sp_TMVehicleInfo_In_Out_Update");
            return true;
        }
        public bool UpdateTMVehicleInfo_In_Out_Status(clsTMVehicleInfo_In_OutProperty data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@RowID", data.RowID);
            cls.AddParameter("@Status", data.Status);
            cls.AddParameter("DateOut", data.DateOut);
            cls.ExecuteNonQuery("sp_TMVehicleInfo_In_Out_Update_Status");
            return true;
        }
        public bool DeleteTMVehicleInfo_In_Out(int id)
        {
            cls.Delete("sp_TMVehicleInfo_In_Out_Delete", "@RowID", id);
            return true;
        }
        #endregion

        #region[Search]
        public DataTable Search(string keywords)
        {
            return cls.Search("sp_TMVehicleInfo_In_Out_Search", "@KEYWORDS", keywords);
        }
        public DataTable TMVehicleInfo_Fillter_Date(string DateBegin, string EndBegin)
        {
            return cls.FillterDay("sp_TMVehicleInfo_In_Out_Fillter_Date", DateBegin, EndBegin);
        }
        public DataTable TMVehicleInfo_Fillter(string status)
        {
            return cls.LayDuLieuParameter1("sp_TMVehicleInfo_In_Out_Fillter_Status", status);
        }
        #endregion
    }
}